package com.lightsaber.cut.entity;

import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;

import com.lightsaber.cut.App;

public class SortUtil {

        
    public static void RandomSortComponent(List<Component> components){
        Random r = new Random(App.POOL_GROUP_SORT);
        
        for (Component component : components) {
            component.setRandomFlag(r.nextInt());
        }
        
        Collections.sort(components, new Comparator<Component>() {
            @Override
            public int compare(Component o1, Component o2) {
                return o1.getRandomFlag().compareTo(o2.getRandomFlag());
            }
        });
    }
}
